package cartaocredito;

import java.rmi.RemoteException;

import cartaocredito_pkg.CartaocreditoLocator;
import cartaocredito_pkg.CartaocreditoPortType;

public class CartaocreditoPortTypeProxy implements CartaocreditoPortType {
  private String _endpoint = null;
  private CartaocreditoPortType cartaocreditoPortType = null;
  
  public CartaocreditoPortTypeProxy() {
    _initCartaocreditoPortTypeProxy();
  }
  
  public CartaocreditoPortTypeProxy(String endpoint) {
    _endpoint = endpoint;
    _initCartaocreditoPortTypeProxy();
  }
  
  private void _initCartaocreditoPortTypeProxy() {
    try {
      cartaocreditoPortType = (new CartaocreditoLocator()).getcartaocreditoPort();
      if (cartaocreditoPortType != null) {
        if (_endpoint != null)
          ((javax.xml.rpc.Stub)cartaocreditoPortType)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
        else
          _endpoint = (String)((javax.xml.rpc.Stub)cartaocreditoPortType)._getProperty("javax.xml.rpc.service.endpoint.address");
      }
      
    }
    catch (javax.xml.rpc.ServiceException serviceException) {}
  }
  
  public String getEndpoint() {
    return _endpoint;
  }
  
  public void setEndpoint(String endpoint) {
    _endpoint = endpoint;
    if (cartaocreditoPortType != null)
      ((javax.xml.rpc.Stub)cartaocreditoPortType)._setProperty("javax.xml.rpc.service.endpoint.address", _endpoint);
    
  }
  
  public CartaocreditoPortType getCartaocreditoPortType() {
    if (cartaocreditoPortType == null)
      _initCartaocreditoPortTypeProxy();
    return cartaocreditoPortType;
  }

@Override
public String validateTransaction(String token, String number, String value)
		throws RemoteException {
	 if (cartaocreditoPortType == null)
		 _initCartaocreditoPortTypeProxy();
	 return cartaocreditoPortType.validateTransaction(token, number, value);
}

@Override
public String getInstallments(String token, String value, String brand)
		throws RemoteException {
	 if (cartaocreditoPortType == null)
		 _initCartaocreditoPortTypeProxy();
	 return cartaocreditoPortType.getInstallments(token, value, brand);
}

@Override
public String doTransaction(String token, String value, String brand,
		String number, String name, String cpf, String code, String date,
		String installments) throws RemoteException {
	 if (cartaocreditoPortType == null)
		 _initCartaocreditoPortTypeProxy();
	 return cartaocreditoPortType.doTransaction(token, value, brand, number, name, cpf, code, date, installments);
}

@Override
public String cancelTransactionById(String token, String transaction_id)
		throws RemoteException {
	 if (cartaocreditoPortType == null)
		 _initCartaocreditoPortTypeProxy();
	 return cartaocreditoPortType.cancelTransactionById(token, transaction_id);
}

@Override
public String getTransactionByID(String token, String transaction_id)
		throws RemoteException {
	if (cartaocreditoPortType == null)
		 _initCartaocreditoPortTypeProxy();
	 return cartaocreditoPortType.getTransactionByID(token, transaction_id);
}

@Override
public String getAllTransactions(String token, String cpf, String status,
		String brand, String date_from, String date_to) throws RemoteException {
	if (cartaocreditoPortType == null)
		 _initCartaocreditoPortTypeProxy();
	 return cartaocreditoPortType.getAllTransactions(token, cpf, status, brand, date_from, date_to);
}

@Override
public String getPaymentBrands(String token) throws RemoteException {
	if (cartaocreditoPortType == null)
		 _initCartaocreditoPortTypeProxy();
	 return cartaocreditoPortType.getPaymentBrands(token);
}

@Override
public String getStatusList(String token) throws RemoteException {
	if (cartaocreditoPortType == null)
		 _initCartaocreditoPortTypeProxy();
	 return cartaocreditoPortType.getStatusList(token);
}
  
  
}